package com.bili.bili_data_api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bili.bili_data_api.dao.mapper.UserMapper;
import com.bili.bili_data_api.dao.pojo.User;
import com.bili.bili_data_api.service.UserService;
import com.bili.bili_data_api.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public Result edit(User user) {
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getAccount,user.getAccount());
        userMapper.update(user,lambdaQueryWrapper);
        return Result.ok().data("info",user);
    }
}
